<include file="Public:header" />
<script type="text/javascript" charset="UTF-8" src="__PUBLIC__/Operation/js/artTemplate/artTemplate.js"></script>
<script type="text/javascript" charset="UTF-8" src="__PUBLIC__/Operation/js/artTemplate/artTemplate-plugin.js"></script>
<script type="text/javascript" charset="UTF-8" src="__PUBLIC__/Operation/js/areaSelect/areaSelect.js"></script>

<div class="headbar">
    <div class="position"><span>会员</span><span>></span><span>商户管理</span><span>></span><span><if condition="$sellerRow.id neq null">编辑<else/>添加</if>商户</span></div>
</div>

<div class="content_box">
    <div class="content form_content">
        <form action="{:U('Partner/seller_add')}" method="post" name="sellerForm" enctype='multipart/form-data'>
            <input name="id" value="" type="hidden" />

            <table class="form_table">
                <colgroup>
                    <col width="150px" />
                    <col />
                </colgroup>

                <tbody>
                    <tr>
                        <th>登陆用户名：</th>
                        <td><input class="normal" name="seller_name" type="text" value="" pattern="required" alt="用户名不能为空" /><label>* 用户名称（必填）</label></td>
                    </tr>
                    <tr>
                        <th>密码：</th><td><input class="normal" name="password" type="password" bind='repassword' empty /><label>* 登录密码</label></td>
                    </tr>
                    <tr>
                        <th>确认密码：</th><td><input class="normal" name="repassword" type="password" bind='password' empty /><label>* 重复确认密码</label></td>
                    </tr>
                    <tr>
                        <th>厂商识别代码：</th>
                        <td><input class="normal" name="ucc_code" type="text" value="" /><label>* 请输入7位、8位或9位厂商识别代码</label></td>
                    </tr>
                    <tr>
                        <th>商户真实全称：</th>
                        <td><input class="normal" name="true_name" type="text" value="" pattern="required" /></td>
                    </tr>
                    <tr>
                        <th>商户简称：</th>
                        <td><input class="normal" name="name" type="text" value="" pattern="required" /></td>
                    </tr>
                    <tr>
                        <th>商户资质材料：</th>
                        <td>
                            <input type='file' name='paper_img' />
                            <if condition="$sellerRow['paper_img'] neq null">
                                <p><a target="_blank" href="__ROOT__/{$sellerRow['paper_img']}"><img src='__ROOT__/{$sellerRow['paper_img']}' style='width:320px;border:1px solid #ccc' /></a></p>
                            </if>
                        </td>
                    </tr>
                    <tr>
                        <th>保证金数额：</th>
                        <td><input type="text" class="normal" name="cash" pattern="float" empty /><label>人民币（元）</label></td>
                    </tr>
                    <tr>
                        <th>收款账号：</th>
                        <td><textarea class="normal" name="account" empty></textarea><label>标明开户行，卡号，账户名称等</label></td>
                    </tr>
                    <tr>
                        <th>固定电话：</th>
                        <td><input type="text" class="normal" name="phone" pattern="phone" /></td>
                    </tr>
                    <tr>
                        <th>手机号码：</th>
                        <td><input type="text" class="normal" name="mobile" pattern="mobi" /></td>
                    </tr>
                    <tr>
                        <th>邮箱：</th>
                        <td><input type="text" class="normal" name="email" pattern="email" empty /></td>
                    </tr>
                    <tr>
                        <th>地区：</th>
                        <td>
                            <select name="province" child="city,area"></select>
                            <select name="city" child="area"></select>
                            <select name="area"></select>
                        </td>
                    </tr>
                    <tr>
                        <th>详细地址：</th><td><input class="normal" name="address" type="text" empty value="" /></td>
                    </tr>
                    <tr>
                        <th>客服QQ号码：</th>
                        <td><input class="normal" name="server_num" type="text" empty value="" /><label>输入客服QQ号码，可以商品详情页面对客户进行解答</label></td>
                    </tr>
                    <tr>
                        <th>企业官网：</th>
                        <td><input class="normal" name="home_url" type="text" pattern="url" empty value="" alt="请填写完整的URL地址，比如：http://www.jumark.cn" /><label>填写完整的网址，如：http://www.jumark.cn</label></td>
                    </tr>
                    <tr>
                        <th>排序：</th>
                        <td><input type='text' class='small' name='sort' /></td>
                    </tr>
                    <tr>
                        <th>是否开通：</th>
                        <td>
                            <label class='attr'><input type='radio' name='is_lock' value='0' checked='checked' />开通</label>
                            <label class='attr'><input type='radio' name='is_lock' value='1' />锁定</label>
                            <label>锁定后商户无法登陆进行管理</label>
                        </td>
                    </tr>
                    <tr>
                        <th>是否VIP：</th>
                        <td>
                            <label class='attr'><input type='radio' name='is_vip' value='0' checked='checked' />否</label>
                            <label class='attr'><input type='radio' name='is_vip' value='1' />是</label>
                        </td>
                    </tr>
                    <tr>
                        <td></td><td><button class="submit" type="submit"><span>确 定</span></button></td>
                    </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>

<script language="javascript">
    //DOM加载完毕
    $(function()
    {
        //修改模式

        var sellerRow = {$json_sellerRow} ? {$json_sellerRow} : '';
        if(sellerRow){
            var formObj = new Form('sellerForm');
            formObj.init(sellerRow);

            //锁定字段一旦注册无法修改
            if($('[name="id"]').val())
            {
                var lockCols = ['seller_name'];
                for(var index in lockCols)
                {
                    $('input:text[name="'+lockCols[index]+'"]').addClass('readonly');
                    $('input:text[name="'+lockCols[index]+'"]').attr('readonly',true);
                }
            }
        }

        //地区联动插件
        var areaInstance = new areaSelect('province',"{:U('Block/area_child')}");
        areaInstance.init({$json_sellerRow});
    });
</script>
<include file="Public:footer" />